package com.example.shop.generator.utils;

import java.io.File;
import java.io.FileNotFoundException;

/**
 * Created by an on 2016/9/27.
 */
public class Folder {

    private static String[] strings = new String[]{"d:", "e:", "f:", "c:", "../../Downloads"};

    public String folder(String folderName) {

        try {
            File f = null;
            String res = null;
            String path = path = folderName.replace(".", "/");
            for (String str : strings) {
                f = new File(str);
                if (f.exists()) {
                    File dir = dir = new File(f + "/src/" + path);
                    dir.mkdirs();
                    res = dir.toString();
                    break;
                }
            }
            return res;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    public static void main(String[] args) throws FileNotFoundException {

        File file = new File("../../Downloads/E9E449465344A6812EC8F010E4FFB93E.jpg");
        System.out.println(file.length());

    }

}
